package com.zr.model;
// Generated 2017-7-3 20:01:15 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "lms")
public class User implements java.io.Serializable {

	private Integer uid;
	private Role role;
	private String uname;
	private String upsw;
	private String ustate;
	private Set<Driver> drivers = new HashSet<Driver>(0);
	private Set<Employeeinformation> employeeinformations = new HashSet<Employeeinformation>(0);
	private Set<Customer> customers = new HashSet<Customer>(0);

	public User() {
	}

	public User(Role role, String uname, String upsw, String ustate, Set<Driver> drivers,
			Set<Employeeinformation> employeeinformations, Set<Customer> customers) {
		this.role = role;
		this.uname = uname;
		this.upsw = upsw;
		this.ustate = ustate;
		this.drivers = drivers;
		this.employeeinformations = employeeinformations;
		this.customers = customers;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)

	@Column(name = "uid", unique = true, nullable = false)
	public Integer getUid() {
		return this.uid;
	}

	public void setUid(Integer uid) {
		this.uid = uid;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "rid")
	public Role getRole() {
		return this.role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	@Column(name = "uname")
	public String getUname() {
		return this.uname;
	}

	public void setUname(String uname) {
		this.uname = uname;
	}

	@Column(name = "upsw")
	public String getUpsw() {
		return this.upsw;
	}

	public void setUpsw(String upsw) {
		this.upsw = upsw;
	}

	@Column(name = "ustate")
	public String getUstate() {
		return this.ustate;
	}

	public void setUstate(String ustate) {
		this.ustate = ustate;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Driver> getDrivers() {
		return this.drivers;
	}

	public void setDrivers(Set<Driver> drivers) {
		this.drivers = drivers;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Employeeinformation> getEmployeeinformations() {
		return this.employeeinformations;
	}

	public void setEmployeeinformations(Set<Employeeinformation> employeeinformations) {
		this.employeeinformations = employeeinformations;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Customer> getCustomers() {
		return this.customers;
	}

	public void setCustomers(Set<Customer> customers) {
		this.customers = customers;
	}

}
